/*
 * File Name:               UILayerEditor.cs
 *
 * Description:             普通类
 * Author:                  lisiyu <576603306@qq.com>
 * Create Date:             2016/11/23
 */

using UnityEditor;
using UnityEngine;

[CustomEditor(typeof(UILayer))]
public class UILayerEditor : Editor
{
    public override void OnInspectorGUI()
    {
        var layer = target as UILayer;

        GUILayout.Box("显示层级", GUILayout.ExpandWidth(true));
        EditorGUILayout.BeginHorizontal();
        layer.pLayer = (UIManager.ELayer)EditorGUILayout.EnumPopup(layer.pLayer, GUILayout.Width(150));
        GUILayout.Box(getComment(layer.pLayer), GUILayout.ExpandWidth(true));
        EditorGUILayout.EndHorizontal();
    }

    private string getComment(UIManager.ELayer layer)
    {
        var ret = "unknown";
        switch (layer)
        {
            case UIManager.ELayer.Active:
                ret = "活动层（处理人物能量条之类）";
                break;

            case UIManager.ELayer.HUD:
                ret = "HUD层 (场景常驻根UI)";
                break;

            case UIManager.ELayer.Popup:
                ret = "弹框层（大部分功能在此）";
                break;

            case UIManager.ELayer.Guide:
                ret = "新手引导层";
                break;

            case UIManager.ELayer.Loading:
                ret = "切换场景读条层";
                break;

            case UIManager.ELayer.Notice:
                ret = "提示信息层（公告tip等提示信息）";
                break;
        }
        return ret;
    }
}